<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('data_setting', false);
my_component_load('jadwal_kerja' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data";

if($_SERVER['REQUEST_METHOD'] == "POST" ):
    $validatepost = form_jadwal_kerja_validate($id);
	switch($task){
		case   "devisicreate" :
			if ($validatepost)
			{
			    $errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_jadwal_kerja_create($id);
				generate_my_web($content,"","plain.php");
				exit;
			}else{
					form_jadwal_kerja_submit($id);
					$content =  "Updated";
					generate_my_web($content,"","plain.php");
					exit;
				 }
		break;
		case   "jabatancreate" :
			form_jabatan_submit();
			$content =  "Updated";
			generate_my_web($content,"","plain.php");
			exit;
		break;
	}

else: 	
	if($task == "edit"){
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com=jadwal_kerja&task=devisicreate&id='.$id , $title , 320	); 
	}elseif($task == "devisicreate"){ 
		$content  = form_jadwal_kerja_create($id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'delete'){ // DELETE ITEM	
		remove_jadwal_kerja_id($id);
		my_direct('index.php?com=jadwal_kerja');
	}else{
		$pagename = "Setting Waktu Kerja";
		load_facebox_script();
		$view =  list_jadwal_kerja(); 
		
	}
endif;  
$content = spliter_browser( $view , $pagename ,'index.php?com=jadwal_kerja&task=edit');
generate_my_web($content, $modulname." _BN_ Setting Waktu Kerja" );
?>